package net.starwifi.duobao.hfg;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

/**
 * Created by STX on 2016/4/11.
 */
public abstract class APIResponse {

    protected String uri = "";
    protected String contentType = "application/json";
    protected String accept = "application/json";
    protected String reqBody = "";

    public APIResponse() {
    }

    public String getContentType() {
        return this.contentType;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

    public String getAccept() {
        return this.accept;
    }

    public void setAccept(String accept) {
        this.accept = accept;
    }

    public String getUri() {
        return this.uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public URI createURI() throws URISyntaxException {
        return new URI(this.uri);
    }

    protected void toJson(StringBuilder msgBuilder) throws IOException {
    }

    protected void toXml(StringBuilder msgBuilder) throws IOException {
    }

    public String getReqBody() {
        return this.reqBody;
    }

    public void setReqBody(String reqBody) {
        this.reqBody = reqBody;
    }

    public abstract String makeSign(String pfxFile, String pfxPwd, String privateKeyPwd);

    public abstract void parseRes(String json);
}
